#pragma once

#include <Hittable.hpp>
#include <memory>

class Sphere : public Hittable {
 public:
  Sphere() = default;
  ~Sphere() override;

  Sphere(glm::vec3 center, float radius, std::shared_ptr<Material> m = nullptr)
      : Hittable(),
        mCenter(std::move(center)),
        mRadius(radius),
        mMaterial(std::move(m)) {}

  bool Hit(const Ray& ray, float t_min, float t_max,
           HitRecord& rec) const override;

  glm::vec3 Center() const { return mCenter; }

  float Radius() const { return mRadius; }

  static glm::vec3 RandomInHemisphere(const glm::vec3& normal);

 private:
  glm::vec3 mCenter = {};
  float mRadius = {};
  std::shared_ptr<Material> mMaterial = {};
};
